using DotNetty.Buffers;
using System.Linq;
using static QQ.Codecs.DotNettyByteBufferExtensions;
namespace QQ.Utils
{
    public static class MiscHelper
    {
        public static int getRandomNumber() => new System.Random().Next();
        public static IByteBuffer getRandomByteArray(int length) => new byte[length].Select(b => b = (byte)getRandomNumber()).ToArray().ToByteBuffer();
        public static string getRandomNumString(int length)
        {
            string ret = "";
            for (int i = 0; i < length; i++) ret += (getRandomNumber() % 10);
            return ret;
        }
        public static string getUUID() => System.Guid.NewGuid().ToString("D");
        public static int getUTCTime() => (int)System.DateTimeOffset.UtcNow.ToUnixTimeSeconds();
    }
}